package com.demo.spring.beans.factory.support;

import com.demo.spring.beans.BeansException;
import com.demo.spring.beans.factory.config.BeanDefinition;

/**
 * Interface for registries that hold bean definitions, for example RootBeanDefinition and ChildBeanDefinition
 * instances. Typically implemented by BeanFactories that internally work with the AbstractBeanDefinition hierarchy.
 * This is the only interface in Spring's bean factory packages that encapsulates registration of bean definitions. The
 * standard BeanFactory interfaces only cover access to a fully configured factory instance.
 * <p>
 * Spring's bean definition readers expect to work on an implementation of this interface. Known implementors within the
 * Spring core are DefaultListableBeanFactory and GenericApplicationContext.
 */
public interface BeanDefinitionRegistry {

    void registryBeanDefinition(String beanName, BeanDefinition beanDefinition);

    BeanDefinition getBeanDefinition(String beanName) throws BeansException;

    boolean containsBeanDefinition(String beanName);

    String[] getBeanDefinitionNames();

}
